package com.leilei.join.window;

import com.leilei.join.common.Vehicle;
import com.leilei.join.common.VehicleDetail;
import com.leilei.join.common.VehicleInfo;
import org.apache.flink.api.common.functions.JoinFunction;

/**
 * @author lei
 * @version 1.0
 * @date 2021/3/27 16:52
 * @desc 车联与详情join
 */
public class VehicleJoinFunction implements JoinFunction<Vehicle, VehicleDetail, VehicleInfo> {

    @Override
    public VehicleInfo join(Vehicle first, VehicleDetail second) throws Exception {
        return VehicleInfo.builder()
                .vehicleId(first.getId())
                .type(first.getType())
                .color(second.getColor())
                .createTime(second.getCreateTime())
                .build();
    }

}